// eslint-disable-next-line no-unused-vars
// eslint-disable-next-line standard/object-curly-even-spacing
import { get, post, deletes, put } from './axios.js'
// const http = 'http://47.105.207.235/v1' http://pc.hdyhlz.com
const http = '/v1'
const http2 = '/v2'
// const http = 'http://pc.hdyhlz.com/v1'
// const http2 = 'http://pc.hdyhlz.com/v2'
// const http = 'http://192.168.31.118:8899/v1'
// const http2 = 'http://192.168.31.118:8899/v2'
// const http = 'http://cs.zgmjzw.com/v7' // 测试地址
const myregMobile = /^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57]|19[0-9]|16[0-9])[0-9]{8}$/
// 加密
const getRSACode = (params) => {
  return get(`${http}/common/rsaEncrypt`, { sign: params })
}
// 解密
const getRsaDecrypt = (params) => {
  return get(`${http}/common/rsaDecrypt`, { sign: params })
}
// 登录
const webLogin = (params) => {
  // eslint-disable-next-line no-undef
  return post(`${http}/member/login`, { secret: params })
}
// 注册
const webRegister = (params) => {
  // eslint-disable-next-line no-undef
  return post(`${http}/member/register`, { secret: params })
}
// 获取验证码
const getVerifyCode = params => {
  return get(`${http}/common/verify`, { secret: params })
}
// 修改密码
const postResetpwd = params => {
  return post(`${http}/member/resetpwd`, { secret: params })
}
/**
 *
 *获取用户信息
 * @param {
 * uuid=登陆返回的uuid 必须参数
 * } params 加密字符串
 * @returns
 */
const getUserInfo = params => {
  return get(`${http}/member/info`, { secret: params })
}
/**
 *
 *用户退出登录
 * @param {
 * uuid=用户uuid 必须参数
 * } params 加密字符串
 * @returns
 */
const userLogout = params => {
  return post(`${http}/member/logout`, { secret: params })
}

/**
 *获取验证公式是否开通
 *
 * @param {
 * time=当前时间
 * }  加密字符串
 * @returns
 */
const getFunction = params => {
  return get(`${http}/open/function`, { secret: params })
}

// 获取优选公式
const getPreferred = params => {
  return get(`${http}/course/free`, { secret: params })
}

/**
 *获取客服列表
 *
 * @param {
 * type=账单类型(全部传0，1为佣金，2为消费，3为充值，4为提现)
 *page,page_size,order,sort}
 * @returns
 */
const getCustomer = params => {
  return get(`${http}/customer/get`, { secret: params })
}
/**
 *获取用户账单列表
 *
 * @param {id=1}
 * @returns
 */
const getIntegral = params => {
  return get(`${http}/integral/list`, { secret: params })
}
/**
 *获取功能详情
 *
 * @param {function_id = open/function 返回的功能编号id}
 * @returns
 */
const getFunctionDetail = params => {
  return get(`${http}/open/functiondetail`, { secret: params })
}
/**
 *开通功能
 *
 * @param {power_id = 权限编号}
 * @returns
 */
const openFunction = params => {
  return get(`${http}/open/opening`, { secret: params })
}
/**
 *获取分享好友
 *
 * @param {power_id = 权限编号}
 * @returns
 */
const getInvitation = params => {
  return get(`${http}/member/invitation`, { secret: params })
}
/**
 *提现
 *
 * @param {power_id = 权限编号}
 * @returns
 */
const withdraw = params => {
  return post(`${http}/withdraw/apply`, { secret: params })
}
/**
 *修改昵称
 *
 * @param { *nickname = 用户名称}
 * @returns
 */
const editInfo = params => {
  return put(`${http}/member/edit`, { secret: params })
}
/**
 *会员等级--可升级等级列表
 *
 * @param { *nickname = 用户名称}
 * @returns
 */
const levelListVip = params => {
  return get(`${http}/level/list`, { secret: params })
}
/**
 *会员等级--可升级收费列表
 *
 * @param { *nickname = 用户名称}
 * @returns
 */
const levelChargeVip = params => {
  return get(`${http}/level/charge`, { secret: params })
}
/**
 *会员等级--升级
 *
 * @param { *nickname = 用户名称}
 * @returns
 */
const levelUpgradeVip = params => {
  return post(`${http}/level/upgrade`, { secret: params })
}
/**
 *获取规则
 *
 * @param {
 * *timestamp=当前时间时间戳
 * state=是否跳转(1为是,2为否)
 * }
 * @returns
 */
const getsystem = params => {
  return get(`${http}/system/system`, { secret: params })
}
/**
 *指令教程
 *
 * @param { *nickname = 用户名称}
 * @returns
 */
const getCourseList = params => {
  return get(`${http}/course/list`, { secret: params })
}
/**
 *获取用户收藏公式列表
 *
 * @param { * uuid=登陆返回的uuid 必须参数}
 * @returns
 */
const getMemberCollectionList = params => {
  return get(`${http}/collection/list`, { secret: params })
}
/**
 *获取收藏记录详情
 *
 * @param { * id= 收藏列表返回的id}
 * @returns
 */
const getMemberCollectionDetail = params => {
  return get(`${http}/collection/detail`, { secret: params })
}
/**
 *修改用户收藏公式备注
 *
 * @param { * collection_id=收藏列表返回的id remark=备注}
 * @returns
 */
const editRemak = params => {
  return post(`${http}/collection/edit`, { secret: params })
}
/**
 *删除用户收藏
 *
 * @param { * collection_id=收藏列表返回的id remark=备注}
 * @returns
 */
const deleteCollection = params => {
  return deletes(`${http}/collection/delete`, { secret: params })
}
/**
 *获取验证记录
 *
 * @param { * uuid=登陆返回的uuid 必须参数  page=当前页 page_size=每页数量}
 * @returns
 */
const GETVerificationGetlist = params => {
  return get(`${http}/verification/getlist`, { secret: params })
}
/**
 *获取验证记录详情
 *
 * @param { * id=验证记录id 必须参数}
 * @returns
 */
const GETVerificationDetail = params => {
  return get(`${http}/verification/detail`, { secret: params })
}
/**
 *获取优选记录详情
 *
 * @param { * id=验证记录id 必须参数}
 * @returns
 */
const getFreeDetailFormula = params => {
  return get(`${http}/free/detail`, { secret: params })
}
/**
 *删除验证记录
 *
 * @param { id = 验证记录的id = 必须参数}
 * @returns
 */
const DELETEverification = params => {
  return deletes(`${http}/verification/delete`, { secret: params })
}
/**
 *验证公式
 *
 * @param {* formula=公式
 * record_id=验证记录的id(从验证记录进入传参，传此参数可以不传formula)
 * collect_id=收藏公式的id(从收藏公式进入传参，传此参数可以不传formula)
 * group_id=群id(在群里发的必传，不是就不传)} params
 * @returns
 */
const verification = params => {
  return post(`${http2}/verification/verification`, params)
}
/**
 *指令验证
 *
 * @param {* formula=公式
    * record_id=验证记录的id(从验证记录进入传参，传此参数可以不传formula)
    * collect_id=收藏公式的id(从收藏公式进入传参，传此参数可以不传formula)
    * group_id=群id(在群里发的必传，不是就不传)} params
    * @returns
    */
const formula = params => {
  return post(`${http2}/instructions/formula`, params)
}
/**
 *收藏公式
 *
 * @param {* formula=公式}
 * @returns
 */
const collectionFormula = params => {
  return post(`${http2}/collection/collect`, params)
}

/**
 *获取高手榜页面类型
 *
 * @param {*  page和page_size} params
 * @returns
 */
const getMasterLitsType = params => {
  return get(`${http}/game/category`, { secret: params })
}

/**
 *获取高手榜列表
 *
 * @param {*  join_bidding=0为经典排行 1为热门高手
 * category_id=二级类型id
 * charge_type=是否收费(0 全部 1免费 2收费)
 * view_type=查看(0全部 1关注的人)
 * order=排序依据(可选字段 正确率:accuracy_ratio 最新发表:created_at)
 * page=当前页
 * page_size=每页显示
}
 * @returns
 */
const getMasterLits = params => {
  return get(`${http}/game/list`, { secret: params })
}

/**
 *获取奖金池
 *
 * @param {*  timestamp=时间戳 }
    * @returns
    */
const getBonus = params => {
  return get(`${http}/bonus/bonus`, { secret: params })
}

/**
 *获取高手详情
 *
 * @param {
 * * member_id=访问的高手的id(/game/list返回的member_id)
 * category_id=二级分类的id
 * }
    * @returns
    */
const getMasterRecords = params => {
  return get(`${http}/game/records`, { secret: params })
}

/**
 *关注用户
 *
 * @param {
    * * member_id=访问的高手的id(/game/list返回的member_id)
    * }
       * @returns
       */
const FollowMember = params => {
  return get(`${http}/member/follow`, { secret: params })
}
/**
 *取消用户关注
 *
 * @param {
    * * member_id=访问的高手的id(/game/list返回的member_id)
    * }
       * @returns
       */
const UnFollowMember = params => {
  return deletes(`${http}/member/unfollow`, { secret: params })
}
/**
 *获取奖金池记录
 *
 * @param {
    * page=当前页
    * page_size=每页显示
    * }
       * @returns
       */
const BonusList = params => {
  return get(`${http}/bonus/list`, { secret: params })
}

/**
 *获取奖金池记录
 *
 * @param {
    * * member_id=访问的高手的id(/game/list返回的member_id)
    * }
       * @returns
       */
const AddListView = params => {
  return post(`${http}/game/view`, { secret: params })
}

/**
 *获取下棋预测号码
 *
 * @param {
    * timestamp=时间戳
    * }
       * @returns
       */
const BonusNumbers = params => {
  return get(`${http}/bonus/numbers`, { secret: params })
}

/**
 *购买预测内容
 *
 * @param {
    *id=(/game/records返回的id)
    * }
       * @returns
       */
const BuyPurchase = params => {
  return post(`${http}/purchase/buy`, { secret: params })
}
/**
 *预测下期开奖号码
 *
 * @param {
    *purchase_id=买料返回的id
    *code=预测的码
    * }
       * @returns
       */
const BonusForecast = params => {
  return post(`${http}/bonus/forecast`, { secret: params })
}

/**
 *获取高手详情
 *
 * @param {
    *member_id=访问的高手的id(/game/list返回的member_id)
    *category_id=二级分类的id
    * }
       * @returns
       */
const MasterDetail = params => {
  return get(`${http}/game/details`, { secret: params })
}

/**
 *获取关注列表
 *
 * @param {
    *member_id=用户id 必须参数
    *page=当前页
    * page_size=每页数量
    * }
       * @returns
       */
const MemberFollowing = params => {
  return get(`${http}/member/following`, { secret: params })
}

/**
 *获取粉丝列表
 *
 * @param {
    *member_id=用户id 必须参数
    *page=当前页
    * page_size=每页数量
    * }
       * @returns
       */
const MemberFollowers = params => {
  return get(`${http}/member/followers`, { secret: params })
}

/**
 *用户点赞
 *
 * @param {
    *member_id=用户id 必须参数
    * }
       * @returns
       */
const MemberLike = params => {
  return post(`${http}/member/like`, { secret: params })
}
/**
 *用户取消点赞
 *
 * @param {
    *member_id=用户id 必须参数
    * }
       * @returns
       */
const MemberUnLike = params => {
  return deletes(`${http}/member/unlike`, { secret: params })
}
/**
 *获取用户买料数据
 *
 * @param {
    *page=当前页
    * page_size=每页显示期数
    * }
       * @returns
       */
const PurchasesGet = params => {
  return get(`${http}/purchase/purchases`, { secret: params })
}

/**
 *获取用户卖料数据
 *
 * @param {
    *page=当前页
    * page_size=每页显示期数
    * }
       * @returns
       */
const PublishGet = params => {
  return get(`${http}/purchase/publish`, { secret: params })
}

/**
 *获取发料列表
 *
 * @param {
    *timestamp=时间戳
    *
    * }
       * @returns
       */
const DispatchListGet = params => {
  return get(`${http}/game/publishcate`, { secret: params })
}
/**
 *发料
 *
 * @param {
    *category_id=类型编号 必须
    * submit_value=提交的值 多个,分隔 必须
    * charge_type=收费类型(1为免费,2为收费,默认为1) 必须
    * charge_amount=收费金额 非必须
    * join_bidding=参与竞价金额 非必须
    * }
       * @returns
       */
const CleanRecorDeletes = params => {
  return deletes(`${http}/game/clean`, { secret: params })
}
/**
 *清除战绩
 *
 * @param {
    *category_id=类型编号 必须 二级
    * }
       * @returns
       */
const DispatchReleasePost = params => {
  return post(`${http}/game/submit`, { secret: params })
}
export default {
  get,
  deletes,
  put,
  post,
  webLogin,
  webRegister,
  getUserInfo,
  userLogout,
  getVerifyCode,
  postResetpwd,
  getFunction,
  getCustomer,
  getIntegral,
  getFunctionDetail,
  openFunction,
  verification,
  collectionFormula,
  getInvitation,
  withdraw,
  editInfo,
  levelListVip,
  levelChargeVip,
  levelUpgradeVip,
  getsystem,
  getCourseList,
  getMemberCollectionList,
  editRemak,
  deleteCollection,
  GETVerificationGetlist,
  DELETEverification,
  formula,
  getRSACode,
  getRsaDecrypt,
  getMemberCollectionDetail,
  GETVerificationDetail,
  getPreferred,
  getFreeDetailFormula,
  getMasterLitsType,
  getMasterLits,
  getBonus,
  getMasterRecords,
  FollowMember,
  UnFollowMember,
  AddListView,
  BonusList,
  BonusNumbers,
  BuyPurchase,
  BonusForecast,
  MasterDetail,
  MemberFollowing,
  MemberFollowers,
  MemberLike,
  MemberUnLike,
  PurchasesGet,
  PublishGet,
  DispatchListGet,
  DispatchReleasePost,
  CleanRecorDeletes
}
